package com.example.shixunandjavagotoyangchen.BoosYang.Day003.Day003_FX1;

import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseMultiItemQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.example.shixunandjavagotoyangchen.R;
import com.shuyu.gsyvideoplayer.video.GSYSampleADVideoPlayer;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.List;

/**
 * 作者:二徒
 * 时间：2021/10/30- 11:07
 * 功能实现：
 */
public class FaxianDay003FX1_Adpter extends BaseMultiItemQuickAdapter<FaxianDay003FX1_Bean.DataBean, BaseViewHolder> {

    public FaxianDay003FX1_Adpter(@Nullable List<FaxianDay003FX1_Bean.DataBean> data) {
        super(data);
        addItemType(1, R.layout.blankfragmentday003faxian1);
        addItemType(2, R.layout.blankfragmentday003faxian2);
        addItemType(3, R.layout.blankfragmentday003faxian3);
        addItemType(4, R.layout.blankfragmentday003faxian4);
    }



    @Override
    protected void convert(@NotNull BaseViewHolder baseViewHolder, FaxianDay003FX1_Bean.DataBean dataBean) {
        switch (dataBean.getItemType()){
            case 1:
                Glide.with(getContext()).load(dataBean.getVideomainimg()).error(R.mipmap.ic_launcher).into((ImageView) baseViewHolder.getView(R.id.qicheng1_img));
                Glide.with(getContext()).load(dataBean.getHeadpath()).error(R.mipmap.ic_launcher).circleCrop().into((ImageView) baseViewHolder.getView(R.id.qicheng1_img2));

                baseViewHolder.setText(R.id.qicheng1_TextView1,dataBean.getAuthname());
                baseViewHolder.setText(R.id.qicheng1_TextView2,dataBean.getCaption());
                baseViewHolder.setText(R.id.qicheng1_name,dataBean.getAuthname());
                break;

            case 2:
                Glide.with(getContext()).load(dataBean.getVideomainimg()).error(R.mipmap.ic_launcher).into((ImageView) baseViewHolder.getView(R.id.qicheng2_img));
                Glide.with(getContext()).load(dataBean.getHeadpath()).error(R.mipmap.ic_launcher).circleCrop().into((ImageView) baseViewHolder.getView(R.id.qicheng2_img2));

                baseViewHolder.setText(R.id.qicheng2_TextView1,dataBean.getAuthname());
                baseViewHolder.setText(R.id.qicheng2_TextView2,dataBean.getCaption());
                baseViewHolder.setText(R.id.qicheng2_name,dataBean.getAuthname());
                break;


            case 3:
                Glide.with(getContext()).load(dataBean.getVideomainimg()).error(R.mipmap.ic_launcher).into((ImageView) baseViewHolder.getView(R.id.qicheng3_img));
                Glide.with(getContext()).load(dataBean.getHeadpath()).error(R.mipmap.ic_launcher).circleCrop().into((ImageView) baseViewHolder.getView(R.id.qicheng3_img2));

                baseViewHolder.setText(R.id.qicheng3_TextView1,dataBean.getAuthname());
                baseViewHolder.setText(R.id.qicheng3_TextView2,dataBean.getCaption());
                baseViewHolder.setText(R.id.qicheng3_name,dataBean.getAuthname());
                break;

            case 4:

                GSYSampleADVideoPlayer player = baseViewHolder.getView(R.id.qicheng4_GSYS);
                player.setUp(""+dataBean.getVideopath(),true,""+dataBean.getAuthname());

                Glide.with(getContext()).load(dataBean.getHeadpath()).error(R.mipmap.ic_launcher).circleCrop().into((ImageView) baseViewHolder.getView(R.id.qicheng4_img));
                baseViewHolder.setText(R.id.qicheng4_TextView,dataBean.getCaption());
                baseViewHolder.setText(R.id.qicheng4_name,dataBean.getAuthname());

                break;


        }
    }
}
